package com.tuanzi.loan.business.service.family.impl;

import com.tuanzi.loan.business.entity.family.LoanCreditCardInfo;
import com.tuanzi.loan.business.repository.family.LoanCreditCardInfoRepository;
import com.tuanzi.loan.business.service.family.LoanCreditCardInfoService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.service.CommonServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.credit.LoanCreditCardInfoRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * User: liangZongXi
 * Create time: 19:51 2018/8/30
 * Description:
 */
@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class LoanCreditCardInfoImpl extends CommonServiceImpl<LoanCreditCardInfo,Long> implements LoanCreditCardInfoService {

    private final LoanCreditCardInfoRepository loanCreditCardInfoRepository;

    @Autowired
    public LoanCreditCardInfoImpl(LoanCreditCardInfoRepository loanCreditCardInfoRepository) {
        this.loanCreditCardInfoRepository = loanCreditCardInfoRepository;
    }

    @Override
    public Page<LoanCreditCardInfo> list(PageSearcher<LoanCreditCardInfoRequest> pageSearcher) {

        return loanCreditCardInfoRepository.list(pageSearcher.getSearchCondition(), pageSearcher.getPageable());
    }

    @Override
    protected JpaRepository<LoanCreditCardInfo, Long> getRepository() {
        return loanCreditCardInfoRepository;
    }
}
